package com.topisv.tms.rest.qimen.command;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.topisv.tms.exception.PaiUException;
import com.topisv.tms.rest.qimen.qmservice.InventoryQueryService;
import com.topisv.tms.rest.qimen.request.RequestMethodType;
import com.topisv.tms.rest.qimen.request.RequestParams;
import com.topisv.tms.rest.qimen.response.ResponseParams;

/**
 * 库存查询接口执行命令类
 * ERP可以通过奇门接口实时查询wms库存信息
 * @author      chenhongtao
 * @version     [v0.0.6, 2016年5月13日]
 * @see         [相关类/方法]（可选）
 * @since       [产品/模块版本] （必须）
 */
@Component
@Lazy(false)
@Transactional(readOnly =  false)
public class InventoryQueryCommand implements IQMRequestCommand,InitializingBean {
	@Autowired
	private InventoryQueryService service;
	@Override
	public void afterPropertiesSet() throws Exception {
		QMRequestCommandContainer.getInstance().add(RequestMethodType.INVENTORY_QUERY.getType(), this);

	}

	@Transactional(readOnly = false,rollbackFor=Exception.class,propagation=Propagation.REQUIRED)
	public ResponseParams execute(RequestParams params) throws PaiUException {
		return service.execute(params);
	}

	@Override
	public void executeBefore(ResponseParams qmResponse) throws PaiUException {
		// TODO Auto-generated method stub
	}

}
